unit u_pesquisaempresadepartamento;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, u_pesquisapadrao, FMTBcd, DB, DBClient, Provider, SqlExpr,
  StdCtrls, AdvEdit, Grids, DBGrids, AdvGlowButton, ExtCtrls, JvExDBGrids,
  JvDBGrid, AdvGroupBox;

type
  TFRM_PesquisaEmpresaDepartamento = class(TFRM_PesquisaPadrao)
    cdsPesquisarCOD_DEPARTAMENTO: TIntegerField;
    cdsPesquisarDESCRICAO: TStringField;
    procedure edtPesquisarKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
    procedure FormShow(Sender: TObject);

  public
    procedure ConsultaListaRegistro(Empresa: integer);
  end;

var
  FRM_PesquisaEmpresaDepartamento: TFRM_PesquisaEmpresaDepartamento;

implementation

{$R *.dfm}

procedure TFRM_PesquisaEmpresaDepartamento.edtPesquisarKeyDown(
  Sender: TObject; var Key: Word; Shift: TShiftState);
begin
  inherited;
  cdsPesquisar.Locate('descricao',edtPesquisar.Text,[loPartialKey,loCaseInsensitive]);
end;

procedure TFRM_PesquisaEmpresaDepartamento.FormShow(Sender: TObject);
begin
  inherited;
  lblTotal.Caption := lblTotal.Caption + ' departamentos';
end;

procedure TFRM_PesquisaEmpresaDepartamento.ConsultaListaRegistro(Empresa:integer);
begin
  cdsPesquisar.Close;
  sqlPesquisar.Params[0].AsInteger := Empresa;
  cdsPesquisar.Open;
end;

end.
